﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<!--#include file="clientinclude.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>保存信息</title>
<link type="text/css" href="style/style.css" rel="stylesheet" rev="stylesheet"/>
</head>
<body>

<%
checkadmin(1)
dim productid,productname,content,productimg,author,upper,orders,specialid,act,addtime,id,pos,typeid,path,sqla,rsa,lang,visible,linkurl,makehtml,keyword
makehtml=HTMLEncode(request.Form("makehtml"))
productid=HTMLEncode(request.Form("productid"))
If (productid="") Then
historygoback("请填写商品型号")
End If 
productname=HTMLEncode(request.Form("productname"))
If (productname="") Then
historygoback("请填写商品名称")
End If 
content=request.Form("content")
If (content="") Then
historygoback("请填写商品描述")
Else
content=Replace(content,"{","&#123;")
End If 
productimg=request.Form("productimg")
author=HTMLEncode(request.Form("author"))
upper=HTMLEncode(request.Form("upper"))
orders=HTMLEncode(request.Form("orders"))
specialid=HTMLEncode(request.Form("specialid"))
act=HTMLEncode(request.Form("act"))
addtime=request.Form("addtime")
id=HTMLEncode(request.Form("id"))
lang=HTMLEncode(request.Form("lang"))
visible=HTMLEncode(request.Form("visible"))
linkurl=HTMLEncode(request.Form("linkurl"))
keyword=HTMLEncode(request.Form("keyword"))

If visible="" Then
	visible=1
End If 
pos=Instr(upper, "_")
typeid=CInt(mid(upper,1,pos-1))
path=mid(upper,pos+1)
Dim nowtime
nowtime=Now()

If act="addsave" Then 
	Set rsa = Server.CreateObject("ADODB.Recordset")
	sqla = "select * from [c_product]"
	rsa.open sqla,conn,1,3
	rsa.addnew
	rsa("productid")=productid
	rsa("productname")=productname
	rsa("content")=content
	rsa("productimg")=productimg
	rsa("author")=author
	rsa("typeid")=typeid
	rsa("orders")=orders
	rsa("path")=path
	rsa("specialid")=specialid
	rsa("visible")=visible
	rsa("lang")=lang
	rsa("linkurl")=linkurl
	rsa("addtime")=nowtime
	rsa("modifytime")=nowtime
	rsa("keyword")=keyword
	rsa.update
	id=rsa("id")
	rsa.close
	Set rsa=Nothing 
	Call updateTypeModifytime(CutPath(path),nowtime)
	Call updateSpecialModifytime(specialid,nowtime)
	If makehtml="1" Then 
		response.write("<table class='table_500' cellspacing='0' cellpadding='0'><tr><th>正在生成HTML</th></tr><tr><td class='tdcenter'>")
		Call MakeOneRecord(RZ_PRE_PRODUCT_SHOW,id,typeid,specialid,path,nowtime,lang)
		response.write("</td></tr></table>")
	End If 
	response.write("<meta http-equiv='refresh' content='0;url=showmsg.asp?from=product_list.asp&msg=AddSuccess&id="&typeid&"&lang="&lang&"'>")
End If 
If act="modifysave" Then 
	Set rsa = Server.CreateObject("ADODB.Recordset")
	sqla = "select * from [c_product] where id="&id
	rsa.open sqla,conn,1,3
	rsa("productid")=productid
	rsa("productname")=productname
	rsa("content")=content
	rsa("productimg")=productimg
	rsa("author")=author
	rsa("typeid")=typeid
	rsa("orders")=orders
	rsa("path")=path
	rsa("specialid")=specialid
	rsa("addtime")=addtime
	rsa("visible")=visible
	rsa("lang")=lang
	rsa("linkurl")=linkurl
	rsa("modifytime")=nowtime
	rsa("keyword")=keyword
	rsa.update
	rsa.close
	Set rsa=Nothing 
	Call updateTypeModifytime(CutPath(path),nowtime)
	Call updateSpecialModifytime(specialid,nowtime)
	If makehtml="1" Then
		response.write("<table class='table_500' cellspacing='0' cellpadding='0'><tr><th>正在生成HTML</th></tr><tr><td class='tdcenter'>")
		Call MakeOneRecord(RZ_PRE_PRODUCT_SHOW,id,typeid,specialid,path,nowtime,lang)
		response.write("</td></tr></table>")
	End If 
	response.write("<meta http-equiv='refresh' content='0;url=showmsg.asp?from=product_list.asp&msg=ModifySuccess&id="&typeid&"&lang="&lang&"'>")
End If 
%>
</body>
</html>